package com.white.ipcprovider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by ytf on 2017/7/17 017.
 * Description:
 */

public class BookDatabaseHelper extends SQLiteOpenHelper
{
    private static final String DB_NAME = "BOOK.DB";
    public static final String BOOK_TB = "book";
    public static final String USER_TB = "user";

    private static final int DB_VERSION = 1;

    public BookDatabaseHelper(Context context)
    {
        super(context, DB_NAME, null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db)
    {
        String CREATE_BOOK = "CREATE TABLE IF NOT EXISTS "+
                BOOK_TB + "(_id INTEGER PRIMARY KEY, NAME TEXT, PRICE FLOAT)";

        String CREATE_USER = "CREATE TABLE IF NOT EXISTS "+
                USER_TB + "(_id INTEGER PRIMARY KEY, NAME TEXT, SEX INT)";
        db.execSQL(CREATE_BOOK);
        db.execSQL(CREATE_USER);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
    {

    }
}
